From 93969c469e98fe872c070f9104aebe16c3b7b550 Mon Sep 17 00:00:00 2001 From: John Paul Wallington Date: Tue, 26 Aug 2003 15:36:50 +0000 Subject: [PATCH] (image-jpeg-p): Don't search beyond length of data. --- lisp/image.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/image.el b/lisp/image.el index 25d05c9902f..5f603ccdd12 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -67,7 +67,8 @@ We accept the tag Exif because that is the same format." (when (and (>= code #xe0) (<= code #xef)) ;; APP0 LEN1 LEN2 "JFIF\0" (throw 'jfif - (string-match "JFIF\\|Exif" (substring data i (+ i nbytes))))) + (string-match "JFIF\\|Exif" + (substring data i (min (+ i nbytes) len))))) (setq i (+ i 1 nbytes)))))))) -- 2.30.2